package org.example.Thread01;

import java.util.Timer;
import java.util.TimerTask;

public class Dome_Thread12 {
    public static void main(String[] args) {
        //使用JDK中提供的类，创建一个定时器
        Timer timer=new Timer();
        timer.schedule(new TimerTask() {
            @Override
            public void run() {
                System.out.println("任务1...");
            }
        },1000);
        timer.schedule(new TimerTask() {
            @Override
            public void run() {
                System.out.println("任务2...");
            }
        },2000);
        timer.schedule(new TimerTask() {
            @Override
            public void run() {
                System.out.println("任务3...");
            }
        },3000);

    }
}
